package com.practice.car.cardataapp.controller;

import com.practice.car.cardataapp.entity.rearEnd.ConditionSubCarForm;
import com.practice.car.cardataapp.entity.rearEnd.UserSubCarForm;
import com.practice.car.cardataapp.service.SubCarService;
import com.practice.car.cardataapp.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * car-data-app project
 *
 * @author ZhangMingXing
 * @date 2020/9/14
 */
@RequestMapping("recom")
@RestController
public class RecomController {
	@Autowired
	private SubCarService service;

	@GetMapping("getChoice")
	public R getChoice(@RequestParam("powerType") String powerType,
	                   @RequestParam("output") Double output,
	                   @RequestParam("type") String type,
	                   @RequestParam("auto") String auto,
	                   @RequestParam("seat") Integer seat,
	                   @RequestParam("priceSection") Integer priceSection,
	                   @RequestParam("current") Integer page) {
		ConditionSubCarForm form = new ConditionSubCarForm(powerType, output, type, auto, seat, priceSection);

		return service.getChoice(form, page);
	}
}
